﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace JPushDemo
{
    /// <summary>
    /// 极光推送结果
    /// </summary>
    public class JPushReult
    {
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool IsSuccess { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string Error { get; set; }

        /// <summary>
        /// success
        /// </summary>
        public static JPushReult Success() => new JPushReult { IsSuccess = true };

        /// <summary>
        /// fail
        /// </summary>
        /// <param name="msg">error msg</param>
        public static JPushReult Fail(string msg) => new JPushReult { Error = msg };
    }

    /// <summary>
    /// 极光推送消息体
    /// </summary>
    public class JPushMsgBody
    {
        /// <summary>
        /// 推送平台：android, ios, quickapp,winphone;
        /// 默认全部平台
        /// </summary>
        public List<string> PlatformList { get; set; } = new List<string> { "android", "ios", "quickapp", "winphone" };

        /// <summary>
        /// 推送目标，注册ID列表,必填
        /// </summary>
        public List<string> RegistrationIdList { get; set; }

        /// <summary>
        /// 通知，用于任务栏；通知和应用内消息必选一项
        /// </summary>
        public JPushNotification Notification { get; set; }

        /// <summary>
        /// 应用内消息；通知和应用内消息必选一项
        /// </summary>
        public JPushMessage Message { get; set; }
    }

    /// <summary>
    /// 极光推送通知模型
    /// </summary>
    public class JPushNotification
    {
        /// <summary>
        /// 通知标题，可为空
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 通知内容，必填
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 额外消息，一般用于有业务跳转
        /// </summary>
        public JPushExtraMsg ExtraContent { get; set; }
    }

    /// <summary>
    /// 极光推送应用内消息
    /// </summary>
    public class JPushMessage
    {
        /// <summary>
        /// 消息标题，可为空
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 消息内容，必填
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 额外消息，一般用于有业务跳转
        /// </summary>
        public JPushExtraMsg ExtraContent { get; set; }
    }

    /// <summary>
    /// 极光推送额外消息
    /// </summary>
    public class JPushExtraMsg
    {
        /// <summary>
        /// 消息类型
        /// </summary>
        public JPushExtraMsgEnum ExtraType { get; set; }

        /// <summary>
        /// 额外消息，一般是json字符串
        /// </summary>
        public string ExtraMsg { get; set; }
    }

    /// <summary>
    /// 极光推送额外消息类型
    /// </summary>
    public enum JPushExtraMsgEnum
    {
        /// <summary>
        /// 通用消息
        /// </summary>
        [Description("通用消息")]
        Common = 0,
    }
}
